package com.ygx.zxing.model

import com.lv.common.network.model.DataResult
import com.lv.common.network.support.serverData
import com.lv.service.network.BaseYgxRsp

/**
 * 创建者：ygx
 * 创建日期：2021/9/17 11:28 PM
 * 描述：TODO
 */
class ZxingRepo(private val service: ZxingService) : IZxingResource {
//    private val _circleRsp = SingleLiveData<CircleHomeBean>()
//    override val circleRsp: LiveData<CircleHomeBean> = _circleRsp


    override suspend fun findCircleList(
        name: String?,
        page: Int,
        pageSize: Int,
    ): DataResult<BaseYgxRsp> {
        return service.findCircleList(name, page, pageSize).serverData()
    }

    override suspend fun findMaterialInformation(
        code: String?,
        page: Int,
        pageSize: Int,
    ): DataResult<BaseYgxRsp> {
        return service.findMaterialInformation(code, page, pageSize).serverData()
    }

//    override suspend fun findCircleList(
//        name: String?,
//        page: Int,
//        pageSize: Int,
//        refresh: SmartRefreshLayout
//    ) {
//        service.findCircleList(name, page = page, pageSize = pageSize)
//            .serverData()
//            .onSuccess {
//                //只要不是接口响应成功
//                onBizError { code, message ->
//                    LogUtils.e("接口 BizError $code ,$message")
//                    refresh.finishLoadMore()
//                }
//                onBizOK<CircleHomeBean> { code, data, message, result ->
//                    _circleRsp.value = data
//                    LogUtils.e("接口 Bizok $data")
//                    refresh.finishRefresh(true)
//                    refresh.finishLoadMore();
//                    return@onBizOK
//                }
//            }
//            .onFailure {
//                LogUtils.e("接口 接口异常 ${it.message}")
//                refresh.finishLoadMore()
//            }
//    }

}